readonly TUNA_ANSI_INFO='\033[37;1m'
readonly TUNA_ANSI_OPTINFO='\033[30;1m'
readonly TUNA_ANSI_ERROR='\033[31;1m'
readonly TUNA_ANSI_SUCCESS='\033[32;1m'
readonly TUNA_ANSI_WARNING='\033[33;1m'

log() {
	local logtype="$1"; shift

	case "$logtype" in
		"SUCCESS")
			printf "$TUNA_ANSI_SUCCESS%b" "$@" 1>&2
			;;
		"WARNING")
			printf "$TUNA_ANSI_WARNING%b" "$@" 1>&2
			;;
		"ERROR")
			printf "$TUNA_ANSI_ERROR%b" "$@" 1>&2
			;;
		"INFO")
			printf "$TUNA_ANSI_INFO%b" "$@" 1>&2
			;;
		"OPTINFO")
			printf "$TUNA_ANSI_OPTINFO%b" "$@" 1>&2
			;;
	esac
}

success() {
	if [ -z "$@" ]; then
		log ERROR "failed\n"
	else
		log SUCCESS "done\n"
	fi
}
